import { ref } from "vue"
import { defineStore } from "pinia"
// 服务图层名
const docName = "traffic"
export const useMapStore = defineStore(
  "map",
  () => {
    //保存地图信息,持久化
    const mapState = ref({
      // 地图
      map: null,
      // 服务图层
      docLayer: new Zondy.Map.Doc("", docName, {
        ip: "localhost",
        port: 6163,
        crossOrigin: "Anonymous",
      }),
      showCube: false,
    })

    return { mapState }
  } /* ,
  {
    persist: {
      enabled: true,
      encryptionKey: "map",
      storage: localStorage,
    },
  } */
)
